package game.combat;

import board.Tile;
import character.MyCharacter;
import java.util.Comparator;

public class CombatActorInitiativeComparator implements Comparator<CombatActor> {
    
    public int compare(CombatActor o1, CombatActor o2) {
	if(o1.equals(o2))
	    return 0;
        else if(o1.getInitiative() > o2.getInitiative())
	    return -1;
        else if(o1.getInitiative() < o2.getInitiative())
            return 1;
        else {
            if(o1 instanceof Tile && o2 instanceof MyCharacter)
                return -1;
            else if(o1 instanceof MyCharacter && o2 instanceof Tile)
                return 1;
            else
                return -1;
        }
    }
}
